//
//  PairChat.m
//  HiQ
//
//  Created by maxwell pang on 12-7-24.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "PairChat.h"
#import "MacrosDefine.h"

@implementation PairChat
@synthesize delegate;
@synthesize peerQQ;

-(id) initWithQQ:(NSUInteger)pQQ ownQQ:(NSUInteger)oQQ
{
    connection = [Connection sharedServerConnection];
    peerQQ = pQQ;
    ownQQ = oQQ;
    return self;
}

- (void) sendMsg:(NSString *)msg
{
    NSString *pairMsg = [NSString stringWithFormat:@"%lu/%lu/%@",peerQQ,ownQQ,msg];
    [connection sendMsg:pairMsg cmd:CMD_FUN_CHAT subcmd:0];
}

-(void) packetHandler:(NSString *)msg
{
//    NSString *msg = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    //如果是聊天信息，则直接显示
    [delegate displayChatMessage:msg nameFlag:PEERNAME];
}

#pragma mark -
#pragma mark ConnectionDelegate Method Implementions

@end
